﻿using System.Collections.Generic;
using System.Linq;

namespace Citi.GocAttributes.Domain
{
    public partial class TypeRuleResult
    {
        public List<TypeRuleResult> SelectByType(DatabaseEnums.TypeResultType type)
        {
            return SelectAll<TypeRuleResult>().Where(x => x.Type == (int) type).ToList();
        }

        public List<TypeRuleResult> SelectActiveByType(DatabaseEnums.TypeResultType type)
        {
            return SelectAllActive<TypeRuleResult>().Where(x => x.Type == (int)type).ToList();
        }

        public TypeRuleResult SelectByTypeAndValue(DatabaseEnums.TypeResultType type, string value)
        {
            return SelectAllActive<TypeRuleResult>().FirstOrDefault(x => x.Type == (int)type && x.Value == value);
        }
    }
}
